Set Up Kubernetes Locally With Docker Desktop

Learn how to set up Kubernetes locally with Docker Desktop.

There are loads of ways to access Kubernetes. It runs on everything from laptops and home Raspberry Pi clusters, all the way to high-performance and highly-available clusters in the cloud.

As this is a quick-start course, you will be shown the easiest ways to get Kubernetes on your personal laptop with Docker Desktop.

There are lots of ways of getting Kubernetes on your laptop, but you will be working with Docker Desktop. It’s updated regularly and, the easiest to navigate. Other options worth investigating include minikube and k3d.

What you get with Docker Desktop#

As the heading suggests, you will get Docker. However, you will also get a single-node Kubernetes cluster, which is great for development and general messing around. In addition to this, you will get the Kubernetes command-line utility (kubectl).

This set of tools means that you can use Docker to build applications into container images, and then deploy them to a certified Kubernetes cluster. Not bad for a free tool that is easy to download and use.

Install Docker Desktop#

You can install Docker Desktop on any Windows 10 or Mac OS laptop. Simply go to docker.com and find the download link. After that, it’s a next next next installer that requires admin privileges.

After the installation is complete, you may have to manually start Kubernetes. Do this by clicking on the whale icon in the top menu bar on Mac OS or the system tray found at the bottom right on Windows. From here, choose Preferences > Kubernetes and then select the Enable Kubernetes checkbox as you can see below:

Enable Kubernetes

Once installed, it runs Docker natively on both Mac OS and Windows. If you’re a Mac user, your single-node Kubernetes cluster will run inside a lightweight VM. If you’re a Windows 10 user, you can enable WSL 2 and have your cluster run natively.

A quick word on Docker Desktop on Windows 10: Recent versions of Windows 10 and Docker Desktop support the WSL 2 subsystem. WSL stands for Windows Subsystem for Linux, which is a clever way to run Linux software on Windows. If you are prompted to enable WSL 2, say “yes” and follow the instructions.

You should switch Docker Desktop into Linux containers mode to follow along with the examples used in the rest of the course. To do this, right-click on the Docker whale in the system tray and choose the Switch to Linux containers option. This will enable your Windows 10 machine to run Linux containers.

You can run the following command from a terminal to verify the installation of docker:

Verify docker

The above command should print the docker version installed: Docker version 20.10.0-rc1, build 5cc2396.

You can verify kubectl by running the following command:

Verify kubectl

The command output has been snipped to make it easier to read.

Output - kubectl --version

At this point, you have Docker and a single-node Kubernetes cluster running on your laptop.

Kubernetes – Fun Facts

Set Up Kubectl Locally